package wnhz.com.business.rebateshop.fragment;

import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import wnhz.com.business.R;
import wnhz.com.business.base.MyBaseActivity;
import wnhz.com.business.base.MyBaseFragment;
import wnhz.com.business.groupshop.ui.TiXianActivity;
import wnhz.com.business.impl.ActionBarClickListener;
import wnhz.com.business.rebateshop.activity.rebate.HelpCenterActivity;
import wnhz.com.business.rebateshop.activity.rebate.TwoWeiMaActivity;
import wnhz.com.business.view.TranslucentActionBar;

/**
 * Created by Administrator on 2017-09-18 0018.
 * 返利分销
 */

public class RebateFragment extends MyBaseFragment implements ActionBarClickListener{
    @BindView(R.id.actionbar)
    TranslucentActionBar actionbar;
    @BindView(R.id.ll_rule)
    LinearLayout llRule;
    @BindView(R.id.tv_getmoney)
    TextView tvGetmoney;
    @BindView(R.id.tv_allmoney)
    TextView tvAllmoney;
    @BindView(R.id.ll_exchange)
    LinearLayout llExchange;
    Unbinder unbinder;


    private MyBaseActivity activity;
    @Override
    protected void handleMsg(Message msg) {

    }

    @Override
    protected View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_rebate_rebate, container, false);
        return view;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO: inflate a fragment view
        View rootView = super.onCreateView(inflater, container, savedInstanceState);
        unbinder = ButterKnife.bind(this, rootView);
        activity = (MyBaseActivity) getActivity();
        actionbar.setData("分享返利",R.drawable.ic_lefft_white, null, 0, "我的二维码", 0,this);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            actionbar.setStatusBarHeight(activity.getStatusBarHeight());
        }


        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @OnClick({R.id.ll_rule, R.id.ll_exchange})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ll_rule://返利规则
                startActivity(HelpCenterActivity.createIntent(activity));
                break;
            case R.id.ll_exchange://去兑换
                startActivity(TiXianActivity.createIntent(getContext()));
                break;
        }
    }

    @Override
    public void onLeftClick() {

    }

    @Override
    public void onRightClick() {
        //二维码

        startActivity(TwoWeiMaActivity.createIntent(getContext()));

    }

    @Override
    public void onEditTextClick() {

    }
}
